﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace TerryDong.Core
{
    public class ConfigHelper
    {
        private const string c_parameterNull = "the input parameter should not be null";

        public static string GetConnectionString(string connName)
        {
            if (string.IsNullOrEmpty(connName))
            {
                throw new ArgumentNullException(c_parameterNull);
            }

            return ConfigurationManager.ConnectionStrings[connName].ConnectionString;
        }

        public static string GetAppSetting(string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException(c_parameterNull);
            }

            return ConfigurationManager.AppSettings[key];
        }
    }
}
